package com.example.detectivedemo.ui;

import com.example.detectivedemo.application.AppService;
import com.example.detectivedemo.utils.LogUtils;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;
import ohos.data.DatabaseHelper;

/**
 * 产品展示能力类
 * 负责管理产品界面的生命周期和服务初始化
 */
public class ProductAbility extends Ability {
    
    private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00205, "ProductAbility");
    
    private AppService appService;
    
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        
        // 初始化应用服务
        DatabaseHelper databaseHelper = new DatabaseHelper(this);
        appService = AppService.getInstance();
        
        // 注册产品界面切片
        super.setMainRoute(ProductAbilitySlice.class.getName());
        
        LogUtils.info("ProductAbility onStart");
    }
    
    @Override
    public void onActive() {
        super.onActive();
        LogUtils.info("ProductAbility onActive");
    }
    
    @Override
    public void onInactive() {
        super.onInactive();
        LogUtils.info("ProductAbility onInactive");
    }
    
    @Override
    public void onBackground() {
        super.onBackground();
        LogUtils.info("ProductAbility onBackground");
    }
    
    @Override
    public void onStop() {
        super.onStop();
        LogUtils.info("ProductAbility onStop");
    }
}